{% extends 'base.html' %}
{% block classlist %}
    <ul id="c_list">
        {% if c_data %}
            {% for item in c_data %}
                {% if index %}
                    {% if index != loop.index %}
                        <li>
                            <a href="{{ url_for('all_students', classname=item.c_id) }}">
                                <span class="glyphicon glyphicon-user"></span>
                                <span>{{ item.c_name }}</span>
                                <span>{{ index }}</span>
                                <span>{{ loop.index }}</span>
                            </a>
                        </li>
                    {% else %}
                        <li>
                            <a class="selected" href="{{ url_for('all_students', classname=item.c_id) }}">
                                <span class="glyphicon glyphicon-user"></span>
                                <span>{{ item.c_name }}</span>
                                <span>index:{{ index }}</span>
                            </a>
                        </li>
                    {% endif %}
                {% endif %}
            {% endfor %}

        {% endif %}
    </ul>
{% endblock %}
{% block students %}
    <ul>
        {% if students %}
            {% for item in students %}
                <li>
                    <span>{{ item.s_id }}</span>
                    <span>{{ item.s_name }}</span>
                    <span>{{ item.s_age }}</span>
                    <input type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#{{ item.s_id }}"
                           value="编辑">
                    <a href="{{ url_for('delete_one',sid=item.s_id) }}">删除</a>
                    <div class="modal fade" id="{{ item.s_id }}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                         aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                        &times;
                                    </button>
                                    <h4 class="modal-title" id="myModalLabel">编辑学生</h4>
                                </div>
                                <div class="modal-body">
                                    <form action="/updateone" method="post">
                                        <input type="text" name="sname" placeholder="姓名" value="{{ item.s_name }}">
                                        <input type="text" name="cname" placeholder="班级名称">
                                        <input type="text" name="sage" placeholder="年龄">
                                        <input type="text" name="ssex" placeholder="性别">
                                        <input type="submit" class="btn bg-info btn-lg" value="保存">
                                    </form>
                                </div>

                            </div><!-- /.modal-content -->
                        </div><!-- /.modal -->
                    </div>
                </li>
            {% endfor %}
        {% endif %}
    </ul>
{% endblock %}